<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="陈嘉乐">
    <title></title>
    <style>
        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
        }

        div {
            width: 800px;
            height: 450px;
            margin: 200px auto;
            position: relative;
        }

        ul {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        li {
            position: absolute;
            top: 0;
            left: 0;
            display: none;
        }

        li.current {
            display: block;
        }

        .container {
            position: relative;


            font-size: 0;
            padding: 5px 0 5px 23px;
            border-radius: 12px;
            background-color: rgba(255, 255, 255, 0.2);
            width: 210px;
            height: 20px;
            top: 310px;
            left: -20px;
        }

        p {

            display: inline-block;
            margin-right: 10px;
            width: 12px;
            height: 12px;
            border-radius: 100%;
            background-color: #fff;
        }

        .btn {
            background-color: red;
        }
    </style>
</head>

<body>
    <div>
        <ul>
            <li class="current"><a href=""><img src="1.jpg" alt=""></a></li>
            <li><a href=""><img src="2.jpg" alt=""></a></li>
            <li><a href=""><img src="3.jpg" alt=""></a></li>
            <li><a href=""><img src="4.jpg" alt=""></a></li>
            <li><a href=""><img src="5.jpg" alt=""></a></li>
            <li><a href=""><img src="6.jpg" alt=""></a></li>
            <li><a href=""><img src="7.jpg" alt=""></a></li>
            <li><a href=""><img src="8.jpg" alt=""></a></li>
        </ul>
        <div class="container">
            <p class="btn"></p>
            <p></p>
            <p></p>
            <p></p>
            <p></p>
            <p></p>
            <p></p>

            <p></p>
        </div>
        <span>
            
        </span>
    </div>


</body>

</html>
<script>
    var lis = document.querySelectorAll('li');
    var index = 0;
    var ps = document.querySelectorAll('p');
    setInterval(changeImage, 1000);
    function changeImage() {
        for (var i = 0; i < lis.length; i++) {
            lis[i].className = '';
            ps[i].className = '';
        }
        index++;
        if (index == 8) {
            index = 0;
        }
        lis[index].className = 'current';
        ps[this.index].className = 'btn';

    }



    

</script>